//
//  UIButton+Extension.m
//  xindailianmeng
//
//  Created by 张东 on 2017/2/7.
//  Copyright © 2017年 xindailianmeng.cn. All rights reserved.
//

#import "UIButton+Extension.h"

@implementation UIButton (Extension)

+ (UIButton *)buttonWithFrame:(CGRect)rect norImgNamed: (NSString *)imgNamed selImgNamed: (NSString *)selImgNamed title: (NSString *)title titleColor: (UIColor *)color selColor: (UIColor *)selColor titleFont:(NSInteger)font target:(id)target selector:(SEL)selector{
    UIButton *btn = [[UIButton alloc] initWithFrame:rect];
    [btn setImage:[UIImage imageNamed:imgNamed] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:selImgNamed] forState:UIControlStateSelected];
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setTitleColor:color forState:UIControlStateNormal];
    [btn setTitleColor:selColor forState:UIControlStateSelected];
    btn.titleLabel.font = kBaseFont_(font);
    [btn addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
    return btn;
}

+ (UIButton *)buttonWithFrame:(CGRect)rect norBagImgNamed: (NSString *)imgNamed selBagImgNamed: (NSString *)selImgNamed title: (NSString *)title titleColor: (UIColor *)color selColor: (UIColor *)selColor titleFont:(NSInteger)font target:(id)target selector:(SEL)selector{
    UIButton *btn = [[UIButton alloc] initWithFrame:rect];
    [btn setBackgroundImage:[UIImage imageNamed:imgNamed] forState:UIControlStateNormal];
    [btn setBackgroundImage:[UIImage imageNamed:selImgNamed] forState:UIControlStateSelected];
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setTitleColor:color forState:UIControlStateNormal];
    [btn setTitleColor:selColor forState:UIControlStateSelected];
    btn.titleLabel.font = kFont_(font);
    [btn addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
    return btn;
}


@end
